package qingke;

public class Calculate {

	public static void main(String[] args) {
		System.out.println(useWhile());
		System.out.println(useDoWhile());
		System.out.println(useFor());
	}

	static int useWhile() {
		int sum = 0, n = 0;
		while (n <= 100) {
			sum = sum + n;
			n = n + 2;
		}
		return sum;
	}
	
	static int useDoWhile() {
		int sum = 0, n = 0;
		do {
			sum = sum + n;
			n = n + 2;
		} while(n <= 100);
		return sum;
	}
	
	static int useFor() {
		int sum = 0;
		for (int i = 0; i <= 100; i = i + 2) {
			sum = sum + i;
		}
		return sum;
	}
}
